package servlet;

import java.util.LinkedList;
import java.util.List;

import domain.Player;
import domain.Table;

public class AuxTable {
   	private List<AuxRow> rows ;
   	public AuxTable() {
         this.rows =new LinkedList<AuxRow>();
   		for (int i = 1; i < 37; i = i + 3) {
   			rows.add(new AuxRow(i));
   		}
	}
	
	public int obtainRow(float number) {
		double result = number / 3;
		int row = 0;
		for (int i = 0; i < 13; i++) {
			if (result > i && result <= i + 1) {
				row = i + 1;
			}
		}
		return row;
	}
	
	
	public void addBet(int number, int amount, Player player, Table table) {
		rows.get(obtainRow(number)-1).getColumn(number).addBet(amount, player, table);
	}
	
	
	public List<AuxRow> getRows() {
		return rows;
	}
	public void setRows(List<AuxRow> rows) {
		this.rows = rows;
	}
}
